package service;

import tools.UtilData;

import java.util.Random;

/**
 * @Author 王志康
 * @Date 2021/9/7 10:02
 * @Version 1.0.0
 */
public class LuckService {
    /**
     * 获取获得的奖项
     *
     * @return 奖项的字符串
     */
    public static String getRandomStr() {
        Random random = new Random();
        int x = random.nextInt(100) + 1;
        if (x <= UtilData.LUCK_FIRST_PROBABILITY) {
            return UtilData.LUCK_FIRST_STR;
        } else if (x <= UtilData.LUCK_SECOND_PROBABILITY+UtilData.LUCK_FIRST_PROBABILITY) {
            return UtilData.LUCK_SECOND_STR;
        }else if(x<=UtilData.LUCK_FIRST_PROBABILITY+UtilData.LUCK_SECOND_PROBABILITY
                +UtilData.LUCK_THIRD_PROBABILITY){
            return UtilData.LUCK_THIRD_STR;
        }else {
            return UtilData.LUCK_FOURTH_STR;
        }
    }
}
